//
//  ViewController.m
//  HelloWorld
//
//  Created by ShiMac on 15/4/22.
//  Copyright (c) 2015年 guoyan. All rights reserved.
//

#import "ViewController.h"
#import "IndicatorAnimation.h"
@interface ViewController ()

{

    IndicatorAnimation *layer;

}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    

    //beginAnimation
    UIButton *bt=[[UIButton alloc]initWithFrame:CGRectMake(100, 300, 80, 30)];
    bt.backgroundColor=[UIColor redColor];
    [bt setTitle:@"bigin" forState:UIControlStateNormal];
    [bt addTarget:self action:@selector(clickbt) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bt];
    
    //stopAniamtion
    UIButton *stopBt=[[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(bt.frame)+20, bt.frame.origin.y, bt.frame.size.width, bt.frame.size.height)];
    stopBt.backgroundColor=[UIColor redColor];
    [stopBt setTitle:@"stop" forState:UIControlStateNormal];
    [stopBt addTarget:self action:@selector(stopAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:stopBt];
    
    layer=[[IndicatorAnimation alloc]initWithFrame:CGRectMake(150, 200, 60, 60)];
    [self.view addSubview:layer];
}


-(void)clickbt
{
    [layer startAnimation];
}

-(void)stopAction
{
    [layer stopAnimation];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
